package com.example.test.model;

import io.swagger.v3.oas.annotations.media.Schema;

import java.time.LocalDateTime;
import java.util.List;

@Schema(description = "表示一个用户的详细信息")
public class User {
    @Schema(description = "用户的唯一标识符", example = "1")
    private long id;
    @Schema(description = "用户的全名", example = "张三")
    private String name;
    @Schema(description = "用户的用户名，用于登录", example = "zhangsan")
    private String username;
    @Schema(description = "用户的密码（哈希）", example = "********")
    private String password;
    @Schema(description = "用户账户的创建时间", pattern = "yyyy-MM-ddTHH:mm:ss")
    private LocalDateTime createdAt;
    @Schema(description = "用户账户的最后更新时间", pattern = "yyyy-MM-ddTHH:mm:ss")
    private LocalDateTime updatedAt;
    @Schema(description = "用户的最近订单列表，包含最近10笔订单")
    private List<Order> recentOrders;

    public long getId() {
        return id;
    }

    public void setId(long id) {
        this.id = id;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getUsername() {
        return username;
    }

    public void setUsername(String username) {
        this.username = username;
    }

    public String getPassword() {
        return password;
    }

    public void setPassword(String password) {
        this.password = password;
    }

    public LocalDateTime getCreatedAt() {
        return createdAt;
    }

    public void setCreatedAt(LocalDateTime createdAt) {
        this.createdAt = createdAt;
    }

    public LocalDateTime getUpdatedAt() {
        return updatedAt;
    }

    public void setUpdatedAt(LocalDateTime updatedAt) {
        this.updatedAt = updatedAt;
    }

    public List<Order> getRecentOrders() {
        return recentOrders;
    }

    public void setRecentOrders(List<Order> recentOrders) {
        this.recentOrders = recentOrders;
    }

    @Override
    public String toString() {
        return "User{" +
                "id=" + id +
                ", name='" + name + '\'' +
                ", username='" + username + '\'' +
                ", password='" + password + '\'' +
                ", createdAt=" + createdAt +
                ", updatedAt=" + updatedAt +
                '}';
    }
}
